require "UnLua"
local SGame = Class()

function SGame:Construct()
    local GameIns=UE4.UGameplayStatics.GetGameInstance(self)
    GameIns.m_Chat:Add(self,self.ReceiveChatMessage)
end

function SGame:ReceiveChatMessage(ChatMessage)
    local Widget=UE4.UWidgetBlueprintLibrary.Create(self,UE4.UClass.Load("/Game/UI/UMG/Chat/Item/UW_ChatChild_Item"))
    Widget.Name:SetText(ChatMessage.PlayerName..":".." ")
    Widget.ChatText:SetText(ChatMessage.ChatInfo)
    self.ChatScroll:AddChild(Widget)
    self.ChatScroll:ScrolltoEnd()
end


return SGame